/*
** check_filename.c for raytracer in /u/all/le_e/public/init_cnf_file
** 
** Made by canh-kiet le
** Login   <le_e@epitech.net>
** 
** Started on  Fri Mar 30 13:09:24 2012 canh-kiet le
** Last update Sun Apr 29 16:58:27 2012 canh-kiet le
*/

#include	"rt.h"

void		check_filename(char *filename)
{
  int		i;
  int		l;

  i = 0;
  while (filename[i] != '\0')
    {
      l = 0;
      while (filename[i] != VALID_CHARS[l])
	{
	  if (filename[0] == '.')
	    disp_err(filename, 0, "Invalid filename");
	  if (filename[i] == '.')
	    {
	      if ((my_strcmp(".cnf", &filename[i])) == 0)
		return ;
	      else
		disp_err(filename, 0, "Invalid extension expected .cnf");
	    }
	  l++;
	}
      i++;
    }
}
